{extend name="common:base" /}
{block name="body"}
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <div class="layui-form-item">
                <label for="folder" class="layui-form-label">
                    目录名
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="folder" name="folder" autocomplete="off" class="layui-input">

                </div>
                <br>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <ol type="I" style="font-size: 12px;margin-top: 10px">
                        <li>1. 不允许使用表情符，请使用符合要求的 UTF-8 字符；</li>
                        <li>2. "/" 用于分割路径，可快速创建子目录，但不要以 "/" 或 "\" 开头，不要出现连续的 "/"；</li>
                        <li>3. 不允许出现名为 ".." 的子目录；</li>
                        <li>4. 总长度控制在 1-254 个字符。</li>
                    </ol>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button class="layui-btn" lay-filter="add" lay-submit="">
                    创建
                </button>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="copyright"}
{/block}
{block name="javascript"}

<script>
    layui.use(['form', 'layer', 'jquery'],
        function () {
            let $ = layui.jquery;
            let form = layui.form, layer = layui.layer;

            //监听提交
            form.on('submit(add)',
                function (data) {
                    $.ajax({
                        url: "{:url('media_create_folder')}",
                        type: 'POST',
                        data: data.field,
                        'success': function (result) {
                            if (result.status === 1) {
                                layer.msg(result.message, { 'icon': 1, 'time': 1000 }, function () {
                                    xadmin.close();
                                    xadmin.father_reload();
                                });
                            } else {
                                layer.msg(result.message, { 'icon': 5, 'time': 8000 });
                            }
                        }
                    }, 'JSON');
                    return false;
                });
        });
</script>
{/block}